package o;

import android.content.Context;
import android.text.SpannableString;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.databinding.ViewDataBinding;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseCardBean;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;

public abstract class cgz<T extends ViewDataBinding> extends cih {
    public Context ʼॱ;
    protected ImageView ʽॱ;
    protected ImageView ʾ;
    public TextView ʿ;
    protected ImageView ˈ;
    protected TextView ˉ;
    protected double ˊˊ = 6.0d;
    public View ˊˋ;
    private T ˋ;
    protected double ˋˊ = 3.0d;

    public cgz(Context context) {
        this.ʼॱ = context;
    }

    public T ʾ() {
        return this.ˋ;
    }

    public void ॱ(T t) {
        this.ˋ = t;
    }

    public void ˊ(T t) {
    }

    public ImageView ʼॱ() {
        return this.ʽॱ;
    }

    public void ˏ(ImageView imageView) {
        this.ʽॱ = imageView;
    }

    public ImageView ˈ() {
        return this.ʾ;
    }

    public void ˎ(ImageView imageView) {
        this.ʾ = imageView;
    }

    public void ˊ(ImageView imageView) {
        this.ˈ = imageView;
    }

    public TextView ˊˋ() {
        return this.ʿ;
    }

    public void ॱ(TextView textView) {
        this.ʿ = textView;
    }

    public TextView ˋˊ() {
        return this.ˉ;
    }

    public void ˊ(TextView textView) {
        this.ˉ = textView;
    }

    public View ˉ() {
        return this.ˊˋ;
    }

    public void ʽ(View view) {
        this.ˊˋ = view;
    }

    public cgz ˏ(View view) {
        return null;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        ˎ((BaseCardBean) cardBean);
    }

    protected boolean ˊᐝ() {
        if (this.ˊᐝ == null || this.ˊᐝ.ॱㆍ() || this.ˊᐝ.ॱᐨ()) {
            return false;
        }
        return true;
    }

    protected void ˎ(BaseCardBean baseCardBean) {
        this.ˊᐝ = baseCardBean;
        if (baseCardBean != null) {
            if (this.ʽॱ != null) {
                w_();
            }
            ˊˊ();
            ˍ();
            if (this.ʿ != null) {
                if (this.ˊᐝ.v_() != null) {
                    this.ʿ.setText(this.ˊᐝ.v_());
                    this.ʿ.setVisibility(0);
                } else {
                    this.ʿ.setVisibility(8);
                }
            }
            if (this.ˉ != null) {
                x_();
            }
        }
    }

    protected void w_() {
        eqx.ˎ(this.ʽॱ, this.ˊᐝ.ॱˌ());
    }

    public void x_() {
        BaseCardBean baseCardBean = (BaseCardBean) this.ˊᐝ;
        CharSequence ˏ = ˏ(baseCardBean);
        if (ˏ != null) {
            this.ˉ.setText(ˏ);
        } else {
            this.ˉ.setText(baseCardBean.O_());
        }
    }

    protected SpannableString ˏ(BaseCardBean baseCardBean) {
        return null;
    }

    public void ˊˊ() {
        BaseCardBean baseCardBean = (BaseCardBean) this.ˊᐝ;
        if (this.ʾ == null) {
            return;
        }
        if (baseCardBean.ͺˎ() == null || baseCardBean.ͺˎ().size() <= 0) {
            this.ʾ.setVisibility(8);
            return;
        }
        String str = (String) baseCardBean.ͺˎ().get(0);
        if (str != null) {
            this.ʾ.setVisibility(0);
            eqx.ˏ(this.ʾ, str, "iconflag");
            return;
        }
        this.ʾ.setVisibility(8);
    }

    public void ˍ() {
        BaseCardBean baseCardBean = (BaseCardBean) this.ˊᐝ;
        if (this.ˈ == null) {
            return;
        }
        if (TextUtils.isEmpty(baseCardBean.ॱʿ())) {
            this.ˈ.setVisibility(8);
            return;
        }
        this.ˈ.setVisibility(0);
        eqx.ˏ(this.ˈ, baseCardBean.ॱʿ(), "iconflag");
    }

    public void ॱ(final chy o_chy) {
        View ˉ = ˉ();
        if (ˉ != null) {
            ˉ.setOnClickListener(new evx(this) {
                final /* synthetic */ cgz ˏ;

                public void ˋ(View view) {
                    if (o_chy != null) {
                        o_chy.ˏ(this.ˏ.ˋᐝ(), this.ˏ);
                    }
                }
            });
        }
    }

    public void ˏ(cig o_cig) {
    }

    public void ᐝ(int i) {
    }

    public int ˋᐝ() {
        return 0;
    }

    public boolean ˋ(TextView textView, String str) {
        if (textView == null) {
            return false;
        }
        if (this.ˉ != null) {
            LayoutParams layoutParams = this.ˉ.getLayoutParams();
            layoutParams.width = -2;
            this.ˉ.setLayoutParams(layoutParams);
        }
        if (dof.ॱ(str)) {
            textView.setVisibility(8);
            return false;
        }
        textView.setVisibility(0);
        textView.setText(str);
        return true;
    }

    protected void ᐝ(TextView textView) {
        if (textView != null) {
            LayoutParams layoutParams = textView.getLayoutParams();
            layoutParams.width = -2;
            textView.setLayoutParams(layoutParams);
        }
    }
}
